/**
 * Created by wlh on 2017/7/30.
 */
'use strict';


export function getRandNum() {
    var rant = {
        2: 45,
        4: 55,
        8: 60,
        0: 100
    }

    let rnd = Math.random() * rant[0];
    if (rnd <= rant[2]) {
        return 2;
    }
    if (rnd > rant[2] && rnd <= rant[4]) {
        return 4;
    }
    if (rnd > rant[4] && rnd <= rant[8]) {
        return 8;
    }
    return 0;
}

export function getRandArray(arrayLength) {
    if (!arrayLength) {
        arrayLength = 4;
    }
    let arr = [];
    for(var i=0; i<arrayLength; i++) {
        arr.push(getRandNum());
    }
    return arr;
}